package com.lvmama.controller.rhino.flow;

import com.github.pagehelper.PageInfo;
import com.lvmama.common.result.Result;
import com.lvmama.pojo.dto.rhino.flow.FlowConversionDTO;
import com.lvmama.pojo.dto.rhino.flow.FlowStatisticsFunnel;
import com.lvmama.pojo.dto.rhino.page.FlowStatisticsVo;
import com.lvmama.pojo.entity.rhino.page.FlowData;
import com.lvmama.pojo.entity.rhino.topic.StatisticCode;
import com.lvmama.service.rhino.flow.FlowConversionService;
import com.lvmama.service.rhino.topic.StatisticCodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @ClassName : FlowConversionController
 * @Description : 流量转化
 * @Author :dongq
 * @Date : 2018/9/3 17:07
 * @Version V1.0
 **/
@RestController
@RequestMapping("/flowConversion")
public class FlowConversionController {
    @Autowired
    StatisticCodeService statisticCodeService;
    @Autowired
    FlowConversionService flowConversionService;


    @GetMapping(value = "getLikeCodeObj")
    List<StatisticCode> getLikeCodeObj(@RequestParam("levelCode") String levelCode){
        return statisticCodeService.getLikeCodeObj(levelCode);
    }
    @GetMapping(value = "getDeviceCodeByLikeNamePcAndWap")
    List<String> getDeviceCodeByLikeNamePcAndWap(@RequestParam("codeName") String codeName){
        return  statisticCodeService.getDeviceCodeByLikeNamePcAndWap(codeName);
    }

    @PostMapping(value = "getFlowbyApp")
    Result<List<FlowStatisticsVo>> getFlowbyApp(@RequestBody FlowConversionDTO flowConversionDTO){
        return  flowConversionService.queryFlowbyApp(flowConversionDTO);
    }
    @PostMapping(value = "getFlowbyChannelWap")
    Result<List<FlowStatisticsVo>> getFlowbyChannelWap(@RequestBody FlowConversionDTO flowConversionDTO){
        return flowConversionService.queryFlowbyChannelWap(flowConversionDTO);
    }
    @PostMapping(value = "getFlowbyChannel")
    Result<List<FlowStatisticsVo>> getFlowbyChannel(@RequestBody FlowConversionDTO flowConversionDTO){
        return flowConversionService.queryFlowbyChannel(flowConversionDTO);
    }

    @PostMapping(value = "getAllFunnel")
    Result<PageInfo<FlowStatisticsFunnel>> getAllFunnel(@RequestBody FlowStatisticsFunnel flowStatisticsFunnel){
        return flowConversionService.queryAllFunnel(flowStatisticsFunnel);
    }

    @PostMapping(value = "getFunnelDetail")
    Result<List<FlowStatisticsFunnel>> getFunnelDetail(@RequestBody FlowStatisticsFunnel flowStatisticsFunnel){
        return flowConversionService.queryFunnelDetail(flowStatisticsFunnel);
    }

    @GetMapping(value = "getLikeCodes")
    List<String> getLikeCodes(@RequestParam("codeName") String codeName){
        return statisticCodeService.getLikeCodes(codeName);
    }
    @PostMapping(value = "getFlowStatisticsData")
    Result<FlowData> getFlowStatisticsData(@RequestBody FlowConversionDTO flowConversionDTO){
        return flowConversionService.queryFlowStatisticsData(flowConversionDTO);
    }

    @PostMapping("updateFunnel")
    void updateFunnel(@RequestBody FlowStatisticsFunnel funnel){
         flowConversionService.updateFunnel(funnel);
    }
    @PostMapping("getFunnel")
    Result<FlowStatisticsFunnel> getFunnel(@RequestBody FlowStatisticsFunnel funnel){
        return flowConversionService.selectFunnel(funnel);
    }
    @PostMapping("deleteFunnelDetail")
    void deleteFunnelDetail(@RequestBody FlowStatisticsFunnel funnel){
        flowConversionService.deleteFunnelDetail(funnel);
    }

    @PostMapping("insertFunnel")
    void insertFunnel(@RequestBody FlowStatisticsFunnel funnel){
        flowConversionService.insertFunnel(funnel);
    }

    @PostMapping("insertFunnelDetail")
    void insertFunnelDetail(@RequestBody FlowStatisticsFunnel funnel){
        flowConversionService.insertFunnelDetail(funnel);
    }

    @PostMapping("deleteFunnel")
    void deleteFunnel(@RequestBody FlowStatisticsFunnel funnel){
        flowConversionService.deleteFunnel(funnel);
    }

    @PostMapping("selectStatisticCode")
    StatisticCode selectStatisticCode(StatisticCode statisticCode){
        return statisticCodeService.selectStatisticCode(statisticCode);
    }

    @PostMapping("getLikeCodeObjNotParent")
    List<StatisticCode> getLikeCodeObjNotParent(String codeName){
        return statisticCodeService.getLikeCodeObjNotParent(codeName);
    }
}
